package org.anjan.dp.abstractfactory.shipimpl;

import org.anjan.dp.abstractfactory.Ship;
import org.anjan.dp.abstractfactory.ShipFactory;

public class DieselShip extends Ship {
//Tell that we will construct the ship with a factory
    private final ShipFactory shipFactory;

//The parts required are given by this factory
    public DieselShip(ShipFactory shipFactory) {
        this.shipFactory = shipFactory;
    }

    @Override
    protected void makeShip() {
        System.out.println("Making diesel ship = " + getName());
        engine = shipFactory.getEngine();
        turbo = shipFactory.getTurbo();
        System.out.println("Engine : " + engine + " , Turbo : " + turbo);
    }
}
